package edu.uiowa.cs.coqview;

import java.io.IOException;

public class CoqviewController {
	public static void main(String[] args) throws IOException {
		StringBuffer in = new StringBuffer("");
		StringBuffer out = new StringBuffer("");
		StringBuffer err = new StringBuffer("");
		
		VernacularFileWrapper vfw = 
			new VernacularFileWrapper("/Users/bnjmnbrmn/Desktop"
					+ "/coqtutorial.v");
		
		CoqtopWrapper ctw = new CoqtopWrapper("/Applications/CoqIdE_8.3.app"+
		"/Contents/Resources/bin/coqtop");
		
		while (vfw.getNextCommand(in) != -1) {
			System.out.println("Command: "+in);
			vfw.processCommand(in);
			ctw.enterCommandGetOutAndErr(in.toString(), out, err);
			System.out.println("Out: "+out);
			System.out.println("Err: "+err);
		}
		
//		for (int i = 0; i < 3; i++) {
//			vfw.getNextCommand(in);
//			System.out.println("Command: "+in);
//			ctw.enterCommandGetOutAndErr(in.toString()+"\n", out, err);
//			System.out.println("Out: "+out);
//			System.out.println("Err: "+err);
//		}
	
//		in.replace(0, in.length(), "Section PropositionalLogic.");
//		System.out.println("Command: "+in);
//		ctw.enterCommandGetOutAndErr(in.toString()+"\n", out, err);
//		System.out.println("Out: "+out);
//		System.out.println("Err: "+err);
//	
//		in.replace(0, in.length(), "Variables P Q R : Prop.");
//		System.out.println("Command: "+in);
//		ctw.enterCommandGetOutAndErr(in.toString()+"\n", out, err);
//		System.out.println("Out: "+out);
//		System.out.println("Err: "+err);
////		
////		out.replace(0, out.length(), "");
////		err.replace(0, err.length(), "");
//		in.replace(0, in.length(), "Theorem distr_and_or :" + 
//				" (P /\\ Q) \\/ (P /\\ R) -> P /\\ (Q \\/ R).");
//		System.out.println("Command: "+in);
//		ctw.enterCommandGetOutAndErr(in.toString()+"\n", out, err);
//		System.out.println("Out: "+out);
//		System.out.println("Err: "+err);
//		
//		in.replace(0, in.length(), "intros H.");
//		System.out.println("Command: "+in);
//		ctw.enterCommandGetOutAndErr(in.toString()+"\n", out, err);
//		System.out.println("Out: "+out);
//		System.out.println("Err: "+err);
		
		
	}
}
